package com.situ.mall.web.service;

import com.mall.common.util.JsonResult;
import com.mall.user.model.dto.address.AddressAddRequest;
import com.mall.user.model.dto.address.AddressUpdateRequest;
import com.mall.user.model.vo.AddressVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 地址管理服务 Feign 客户端
 */
@FeignClient(name = "user-api", path = "/address", contextId = "address-api")
public interface AddressFeignService {

    /**
     * 添加地址
     */
    @PostMapping("/add")
    JsonResult<String> addAddress(@RequestBody AddressAddRequest addressAddRequest);

    /**
     * 更新地址
     */
    @PutMapping("/update")
    JsonResult<Boolean> updateAddress(@RequestBody AddressUpdateRequest addressUpdateRequest);

    /**
     * 删除地址
     */
    @DeleteMapping("/delete/{addressId}")
    JsonResult<Boolean> deleteAddress(@PathVariable("addressId") String addressId);

    /**
     * 获取用户所有地址
     */
    @GetMapping("/list")
    JsonResult<List<AddressVO>> getUserAddresses();

    /**
     * 获取特定地址
     */
    @GetMapping("/get/{addressId}")
    JsonResult<AddressVO> getAddressById(@PathVariable("addressId") String addressId);

    /**
     * 获取默认地址
     */
    @GetMapping("/get/default")
    JsonResult<AddressVO> getDefaultAddress();

    /**
     * 设置默认地址
     */
    @PutMapping("/default/{addressId}")
    JsonResult<Boolean> setDefaultAddress(@PathVariable("addressId") String addressId);
} 